package com.hacoc.countdown.model;

import java.io.Serializable;
import java.util.Set;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;


/** 
 *        @hibernate.class
 *         table="user_info"
 *     
*/
public class UserInfo implements Serializable {

    /** identifier field */
    private String userId;

    /** nullable persistent field */
    private String userName;

    /** nullable persistent field */
    private String userPass;

    /** nullable persistent field */
    private String email;

    /** persistent field */
    private Set myCountDowns;

    /** persistent field */
    private Set favorites;

    /** persistent field */
    private Set advices;

    /** full constructor */
    public UserInfo(String userId, String userName, String userPass, String email, Set myCountDowns, Set favorites, Set advices) {
        this.userId = userId;
        this.userName = userName;
        this.userPass = userPass;
        this.email = email;
        this.myCountDowns = myCountDowns;
        this.favorites = favorites;
        this.advices = advices;
    }

    /** default constructor */
    public UserInfo() {
    }

    /** minimal constructor */
    public UserInfo(String userId, Set myCountDowns, Set favorites, Set advices) {
        this.userId = userId;
        this.myCountDowns = myCountDowns;
        this.favorites = favorites;
        this.advices = advices;
    }

    /** 
     *            @hibernate.id
     *             generator-class="assigned"
     *             type="java.lang.String"
     *             column="user_id"
     *         
     */
    public String getUserId() {
        return this.userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    /** 
     *            @hibernate.property
     *             column="user_name"
     *             length="50"
     *         
     */
    public String getUserName() {
        return this.userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    /** 
     *            @hibernate.property
     *             column="user_pass"
     *             length="20"
     *         
     */
    public String getUserPass() {
        return this.userPass;
    }

    public void setUserPass(String userPass) {
        this.userPass = userPass;
    }

    /** 
     *            @hibernate.property
     *             column="email"
     *             length="50"
     *         
     */
    public String getEmail() {
        return this.email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    /** 
     *            @hibernate.set
     *             lazy="true"
     *             inverse="true"
     *             cascade="none"
     *            @hibernate.collection-key
     *             column="user_id"
     *            @hibernate.collection-one-to-many
     *             class="com.hacoc.countdown.model.MyCountDown"
     *         
     */
    public Set getMyCountDowns() {
        return this.myCountDowns;
    }

    public void setMyCountDowns(Set myCountDowns) {
        this.myCountDowns = myCountDowns;
    }

    /** 
     *            @hibernate.set
     *             lazy="true"
     *             inverse="true"
     *             cascade="none"
     *            @hibernate.collection-key
     *             column="user_id"
     *            @hibernate.collection-one-to-many
     *             class="com.hacoc.countdown.model.Favorite"
     *         
     */
    public Set getFavorites() {
        return this.favorites;
    }

    public void setFavorites(Set favorites) {
        this.favorites = favorites;
    }

    /** 
     *            @hibernate.set
     *             lazy="true"
     *             inverse="true"
     *             cascade="none"
     *            @hibernate.collection-key
     *             column="user_id"
     *            @hibernate.collection-one-to-many
     *             class="com.hacoc.countdown.model.Advice"
     *         
     */
    public Set getAdvices() {
        return this.advices;
    }

    public void setAdvices(Set advices) {
        this.advices = advices;
    }

    public String toString() {
        return new ToStringBuilder(this)
            .append("userId", getUserId())
            .toString();
    }

    public boolean equals(Object other) {
        if ( (this == other ) ) return true;
        if ( !(other instanceof UserInfo) ) return false;
        UserInfo castOther = (UserInfo) other;
        return new EqualsBuilder()
            .append(this.getUserId(), castOther.getUserId())
            .isEquals();
    }

    public int hashCode() {
        return new HashCodeBuilder()
            .append(getUserId())
            .toHashCode();
    }

}
